package com.woniu.springbootshiro.controller;

import com.woniu.springbootshiro.pojo.User;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
//  @Autowired
//  private GoodsService goodsService;

  /**
   * 首页，并将登录用户的全名返回前台
   *
   * @param model
   * @return
   */
  @RequestMapping(value = {"/", "/index"})
  public String index(Model model) {
    User sysUser = (User) SecurityUtils.getSubject().getPrincipal();
    model.addAttribute("userName", sysUser.getFullName());
//    List<Goods> goods = goodsService.selectAllGoods();
//    System.out.println(goods);
//    model.addAttribute("goods", goods);
    return "index";
  }
}
